source(here::here("code/load.R"))

#The SPSS sav file is impossible to read.

here("data/meta_analyses_raw/HouCon2019/Fig1_data.csv") |>
    read_csv() |>
    mutate(meta_id = "HouCon2019",
           subfield = "CP",
           question = "Is conservative ideology associated to lower integrative complexity?",
           overall_effect = "both",
           study_year = as.numeric(str_extract(Study_id, "\\d{4}")),
           numbers = str_extract_all(B_ci, "[-+]?[.]?[0-9]+[[.][0-9]+]?")) |>
  unnest_wider(numbers, names_sep = "") |>
  rename(estimate = "numbers1",
         ci_low = "numbers2",
         ci_high = "numbers3") |>
  mutate(std.error = (as.numeric(ci_high) - as.numeric(ci_low)) / 3.92) |>
  select(meta_id,
         subfield,
         question,
         study_id = Study_id,
         study_year,
         subset = Subset,
         estimate,
         std.error,
         question,
         overall_effect) |>
    write_csv(here("data/meta_analyses_clean/HouCon2019.csv"))
